package huaweiod.first;

import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

/**
 * 华为OD机试真题 Java 实现【计算数组中心位置】【2022.11 Q4 新题】
 */
public class A_2023_24_CalculateArrayMidIndex {

    public static int process(List<Integer> nums) {
        // process
        if(nums.size() == 1) {
            return 0;
        }
        int leftMul = 1;
        int rightMul = 1;
        for (int i = 0; i < nums.size(); i++) {
            rightMul *= nums.get(i);
        }
        for (int i = 0; i < nums.size(); i++) {
            rightMul /= nums.get(i);
            if(i != 0) {
                leftMul *= nums.get(i - 1);
            }
            if(leftMul == rightMul) {
                return i;
            }
        }
        return -1;
    }

    public static void main(String[] args) {
        // 处理输入
        Scanner in = new Scanner(System.in);
        //转为数组
        List<Integer> nums = Arrays.stream(in.nextLine().split(" "))
                .map(Integer::parseInt)
                .collect(Collectors.toList());
        System.out.println(process(nums));
    }
}
